package com.cefa.finance.dao;

import com.cefa.finance.model.AccidentRecord;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@SuppressWarnings("ALL")
@Repository
@Transactional
public interface AccidentRecordRepository extends CrudRepository<AccidentRecord, Long> {

    @Query(value = "select * from cefa_finance_accident_record where user_id=?1 and vehicle_id=?2",nativeQuery = true)
    List<AccidentRecord> findByUserIdAndVehicleId(Long userId, Long vehicleId);

    @Query(value = "select * from cefa_finance_accident_record where block_status is not true ",nativeQuery = true)
    List<AccidentRecord> findUnBlockedAccidentRecord();
}
